home *** CD-ROM | disk | FTP | other *** search
/ Mac Magazin/MacEasy 32 / Mac Magazin and MacEasy Magazine CD - Issue 32.iso / Grafik & Text / OzTeX3.0 / Metafont / Inputs / ec / txrfract.mf < prev    next >
Text File  |  1997-03-16  |  9KB  |  201 lines

  1. % txrfract.mf
  2. %
  3. % (c) Copyright 1995, 1996, 1997 J"org Knappen
  4. %
  5. % This file is part of ecfonts version 1.0
  6. %
  7. % Please read the files 00readme.txt, 00inst.txt, 00error.txt, and
  8. % copyrite.txt for further information
  9. %
  10. % You find some documentation in ecdoc.tex (needs LaTeX2e)
  11. %
  12. % Ready made fractions 1/2, 1/4, 3/4 in roman style
  13.  
  14. version_check(1,0);  % |version_check| was introduced in dc1.3
  15.  
  16. ecchar"Fraction one quarter";
  17. beginchar(oct"274",8u#,body_height#,desc_depth#);
  18. italcorr body_height#*slant-.5u#;
  19. adjust_fit(0,0);
  20. numeric c_height; c_height=good.y .5[h,-d]+.5rule_thickness;
  21. numeric light_stem; light_stem=hround .4[stem',cap_stem'];
  22. pickup tiny.nib;
  23. pos1(light_stem,0); pos2(light_stem,0);
  24. lft x1l=lft x2l=hround(.5(w+.5u)-.5cap_stem');
  25. top y1=h+o; bot y2=c_height+rule_thickness;
  26. filldraw stroke z1e--z2e;  % stem
  27. if not serifs: save slab; slab=bar; fi
  28. dish_serif(2,1,a,1/3,min(2.25u,lft x2l-1.5u),
  29.   b,1/3,min(2.25u,w-1.25u-rt x2r)); % serif
  30. pickup crisp.nib; pos3(slab,-90); pos4(bar,-90);
  31. top y3l=h+o; top y4l=if monospace: .8 else: .9 fi\\ [bot y2,h]+o;
  32. lft x4=max(1.25u,tiny.lft x1l-2.35u);
  33. tiny.rt x1r=lft x3+.25[tiny,hair];
  34. erase fill z3l{x4l-x3l,3(y4l-y3l)}...z4l{left}
  35.  --(x4l,h+o+1)--(x3l,h+o+1)--cycle; % erase excess at top
  36. filldraw stroke z3e{x4e-x3e,3(y4e-y3e)}..z4e{left};  % point
  37. penlabels(1,2,3,4);
  38. clearxy;
  39. numeric hh; hh=c_height-2rule_thickness;
  40. numeric light_stem, light_stem', diag_stem, alpha, cut; cut=.75notch_cut;
  41. light_stem=hround .4[fudged.stem,fudged.cap_stem];
  42. light_stem'=hround max(tiny.breadth,light_stem-2stem_corr);
  43. diag_stem=max(tiny.breadth,.4[vair,fudged.hair]);
  44. pickup crisp.nib; pos5(cap_bar,90); pos6(cap_bar,90);
  45. lft x5=hround .5u; rt x6=hround(w-.5u);
  46. top y5r=vround(if serifs: 5/18[slab-d,hh-light_stem]+1
  47.  else:.35[-d,hh-light_stem] fi+.5cap_bar);
  48. z4l=top lft z5r; y2=y2'=y5=y6; x1r=x2r=hround(w-3u+.5light_stem);
  49. penpos1(light_stem',0); penpos2(light_stem',0); y1=y3=hh+apex_o+apex_oo;
  50. x3r+apex_corr=x1r; alpha=diag_ratio(1,diag_stem,y3-y4l,x3r-x4l);
  51. penpos3(alpha*diag_stem,0); penpos4(alpha*diag_stem,0);
  52. x0=x1l; z0=whatever[z3r,z4r];
  53. x5'=x5; z5''=z5'+penoffset z4-z3 of currentpen=whatever[z4l,z3l];
  54. fill diag_end(2r,1r,1,.5,3l,4l)---z5''...lft z5'
  55.  ---lft z5l -- (x4r,y5l) -- z4r
  56.  if y0<hh-cut:{z3r-z4r}...{up}(x1l-1,hh-cut)
  57.   --(x1l,hh-cut) else: -- z0 fi
  58.  --z2l--z2r--cycle;  % diagonal and upper stem
  59. filldraw stroke z5e--z6e;  % bar
  60. pickup tiny.nib; pos7(light_stem,0); rt x7r=x1r; bot y7=-d;
  61. pos2'(light_stem,0); x2'=x7;
  62. filldraw stroke z2'e--z7e;  % lower stem
  63. if serifs: dish_serif(7,2',a,1/3,1.75u,
  64.  b,1/3,min(1.75u,w-.5u-rt x7r)); fi  % serif
  65. penlabels(0,1,2,3,4,5,6,7);
  66. pickup rule.nib;
  67. top y98=top y99=c_height; x98=w-x99=hround .5u;
  68. draw z98--z99; % fraction bar
  69. labels(98,99); endchar;
  70.  
  71. ecchar"Fraction one half";
  72. beginchar(oct"275",8u#,body_height#,desc_depth#);
  73. italcorr body_height#*slant-.5u#;
  74. adjust_fit(0,0);
  75. numeric c_height; c_height=good.y .5[h,-d]+.5rule_thickness;
  76. numeric light_stem; light_stem=hround .4[stem',cap_stem'];
  77. pickup tiny.nib;
  78. pos1(light_stem,0); pos2(light_stem,0);
  79. lft x1l=lft x2l=hround(.5(w+.5u)-.5cap_stem');
  80. top y1=h+o; bot y2=c_height+rule_thickness;
  81. filldraw stroke z1e--z2e;  % stem
  82. if not serifs: save slab; slab=bar; fi
  83. dish_serif(2,1,a,1/3,min(2.25u,lft x2l-1.5u),
  84.   b,1/3,min(2.25u,w-1.25u-rt x2r)); % serif
  85. pickup crisp.nib; pos3(slab,-90); pos4(bar,-90);
  86. top y3l=h+o; top y4l=if monospace: .8 else: .9 fi\\ [bot y2,h]+o;
  87. lft x4=max(1.25u,tiny.lft x1l-2.35u);
  88. tiny.rt x1r=lft x3+.25[tiny,hair];
  89. erase fill z3l{x4l-x3l,3(y4l-y3l)}...z4l{left}
  90.  --(x4l,h+o+1)--(x3l,h+o+1)--cycle; % erase excess at top
  91. filldraw stroke z3e{x4e-x3e,3(y4e-y3e)}..z4e{left};  % point
  92. penlabels(1,2,3,4);
  93. clearxy;
  94. numeric arm_thickness, hair_vair; hair_vair=.25[vair,hair];
  95. arm_thickness=Vround(if hefty:slab+2stem_corr else:.4[stem,cap_stem] fi);
  96. pickup crisp.nib; pos7(arm_thickness,-90); pos8(hair,0);
  97. bot y7r=-d; lft x7=hround .9u; rt x8r=hround(w-.9u);
  98. y8=good.y(y7l+beak/2)+eps;
  99. arm(7,8,a,.3beak_darkness,beak_jut);  % arm and beak
  100. pickup fine.nib; pos2(slab,90); pos3(.4[curve,cap_curve],0);
  101. top y2r=c_height-2rule_thickness+o;
  102. x2=.5(w-.5u); rt x3r=hround(w-.9u); y3+.5vair=.75[-d,top y2r];
  103. if serifs: numeric bulb_diam; bulb_diam=hround(flare+2/3(cap_stem-stem));
  104.  pos0(bulb_diam,180); pos1(cap_hair,180);
  105.  lft x1r=hround .9u; y1-.5bulb_diam=2/3[-d,top y2r];
  106.  (x,y2l)=whatever[z1l,z2r]; x2l:=x; bulb(2,1,0);  % bulb and arc
  107. else: x2l:=x2l-.25u; pos1(flare,angle(-9u,h));
  108.  lft x1r=hround .75u; bot y1l=vround .7[-d,top y2r];
  109.  y1r:=good.y y1r+eps; x1l:=good.x x1l;
  110.  filldraw stroke term.e(2,1,left,.9,4); fi  % terminal and arc
  111. pos4(.25[hair_vair,cap_stem],0);
  112. pos5(hair_vair,0); pos6(hair_vair,0);
  113. y5=arm_thickness-d; y4=.3[y5,y3]; top y6=min(y5,slab-d,top y7l);
  114. lft x6l=crisp.lft x7; z4l=whatever[z6l,(x3l,bot .58[-d,top y2r])];
  115. z5l=whatever[z6l,z4l];
  116. erase fill z4l--z6l--lft z6l--(lft x6l,y4l)--cycle;  % erase excess at left
  117. filldraw stroke z2e{right}..tension atleast .9 and atleast 1
  118.  ..z3e{down}.. z4e---z5e--z6e;  % stroke
  119. penlabels(0,1,2,3,4,5,6,7,8);
  120. pickup rule.nib;
  121. top y98=top y99=c_height; x98=w-x99=hround .5u;
  122. draw z98--z99; % fraction bar
  123. labels(98,99); endchar;
  124.  
  125. ecchar"Fraction three quarters";
  126. beginchar(oct"276",8u#,body_height#,desc_depth#);
  127. italcorr body_height#*slant-.5u#;
  128. adjust_fit(0,0);
  129. numeric c_height; c_height=good.y .5[h,-d]+.5rule_thickness;
  130. numeric top_thickness,mid_thickness,bot_thickness;
  131. top_thickness=max(fine.breadth,vround(slab-2vair_corr));
  132. mid_thickness=max(fine.breadth,vround 2/3vair);
  133. bot_thickness=max(fine.breadth,vround(slab-vair_corr));
  134. pickup fine.nib; pos2(top_thickness,90); top y2r=h+o;
  135. pos3(max(fine.breadth,.6[curve,cap_curve]-stem_corr),0);
  136. rt x3r=hround(w-1.25u);
  137. pos4(vair,-90); pos5(vair,-90);
  138. pos6(mid_thickness,90); x2=x6=x8=.5[1.5u,x7];
  139. pos7(cap_curve,0); rt x7r=hround(w-.75u); lft x5=min(hround 3u,lft x6)-eps;
  140. pos8(bot_thickness,-90); bot y8r=c_height+rule_thickness-o;
  141. y3=.6[top y4l,bot y2l]; y7=.5[bot y6l,top y8l];
  142. top y5l=vround(.54[bot y8r,h]+.5vair); y5r=y6l;
  143. x4=1/3[x5,x3l]; z4=z5+whatever*(150u,h);
  144. filldraw stroke pulled_super_arc.e(2,3)(.5superpull)
  145.  & z3e{down}...z4e---z5e;  % upper bowl
  146. filldraw z5r--z6l--z6r--z5l---cycle;  % middle tip
  147. filldraw stroke pulled_super_arc.e(6,7)(.5superpull)
  148.  & pulled_super_arc.e(7,8)(.5superpull);  % lower bowl
  149. if serifs: numeric bulb_diam[];
  150.  bulb_diam1=flare+.5(cap_stem-stem); bulb_diam2=flare+cap_stem-stem;
  151.  pos0(bulb_diam1,180); pos1(hair,180);
  152.  lft x0r=hround 1.25u;
  153.  y0=min(.9[bot y8r,h]-.5bulb_diam1,.75[bot y8r,h]+.5bulb_diam1);
  154.  bulb(2,1,0);  % upper bulb
  155.  pos10(bulb_diam2,-180); pos9(cap_hair,-180);
  156.  lft x10r=hround .75u;
  157.  y10=max(.1[bot y8r,h]+.5bulb_diam2,.3[bot y8r,h]-.5bulb_diam2);
  158.  bulb(8,9,10);  % lower bulb
  159. else: pos1(.5[vair,flare],angle(-8u,h));
  160.  lft x1r=hround u; bot y1l=vround .75[bot y8r,h]+o;
  161.  y1r:=good.y y1r+eps; x1l:=good.x x1l;
  162.  pos9(bot_thickness,angle(-2u,-h));
  163.  lft x9r=hround .75u; top y9l=vround .25[bot y8r,h]-o;
  164.  y9r:=good.y y9r-eps; x9l:=good.x x9l;
  165.  filldraw stroke term.e(2,1,left,1,4);  % upper terminal
  166.  filldraw stroke term.e(8,9,left,1,4); fi  % lower terminal
  167. penlabels(0,1,2,3,4,5,6,7,8,9,10);
  168. clearxy;
  169. numeric hh; hh=c_height-2rule_thickness;
  170. numeric light_stem, light_stem', diag_stem, alpha, cut; cut=.75notch_cut;
  171. light_stem=hround .4[fudged.stem,fudged.cap_stem];
  172. light_stem'=hround max(tiny.breadth,light_stem-2stem_corr);
  173. diag_stem=max(tiny.breadth,.4[vair,fudged.hair]);
  174. pickup crisp.nib; pos5(cap_bar,90); pos6(cap_bar,90);
  175. lft x5=hround .5u; rt x6=hround(w-.5u);
  176. top y5r=vround(if serifs: 5/18[slab-d,hh-light_stem]+1
  177.  else:.35[-d,hh-light_stem] fi+.5cap_bar);
  178. z4l=top lft z5r; y2=y2'=y5=y6; x1r=x2r=hround(w-3u+.5light_stem);
  179. penpos1(light_stem',0); penpos2(light_stem',0); y1=y3=hh+apex_o+apex_oo;
  180. x3r+apex_corr=x1r; alpha=diag_ratio(1,diag_stem,y3-y4l,x3r-x4l);
  181. penpos3(alpha*diag_stem,0); penpos4(alpha*diag_stem,0);
  182. x0=x1l; z0=whatever[z3r,z4r];
  183. x5'=x5; z5''=z5'+penoffset z4-z3 of currentpen=whatever[z4l,z3l];
  184. fill diag_end(2r,1r,1,.5,3l,4l)---z5''...lft z5'
  185.  ---lft z5l -- (x4r,y5l) -- z4r
  186.  if y0<hh-cut:{z3r-z4r}...{up}(x1l-1,hh-cut)
  187.   --(x1l,hh-cut) else: -- z0 fi
  188.  --z2l--z2r--cycle;  % diagonal and upper stem
  189. filldraw stroke z5e--z6e;  % bar
  190. pickup tiny.nib; pos7(light_stem,0); rt x7r=x1r; bot y7=-d;
  191. pos2'(light_stem,0); x2'=x7;
  192. filldraw stroke z2'e--z7e;  % lower stem
  193. if serifs: dish_serif(7,2',a,1/3,1.75u,
  194.  b,1/3,min(1.75u,w-.5u-rt x7r)); fi  % serif
  195. pickup rule.nib;
  196. top y98=top y99=c_height; x98=w-x99=hround .5u;
  197. draw z98--z99; % fraction bar
  198. labels(98,99); endchar;
  199.  
  200. endinput;
  201.